package data_structure.mooc;

import data_structure.implement.QueueImp;

public class PriorityQueue<E extends Comparable<E>> implements QueueImp<E> {

    private MaxHeap<E>heap;

    public PriorityQueue(){
        heap=new MaxHeap<E> ();
    }

    @Override
    public boolean isEmpty() {
        return heap.isEmpty ();
    }

    @Override
    public void enqueue(E e) {
        heap.add (e);
    }

    @Override
    public E dequeue() {
        return heap.extractMax ();
    }

    @Override
    public E getFront() {
        return heap.findMax ();
    }

    @Override
    public int getSize() {
        return heap.getSize ();
    }
}
